<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://www.springframework.org/security/tags"
	prefix="security"%>

<style type="text/css">
<!--
.STYLE1 {
	font-size: 12px
}

.STYLE3 {
	color: #707070;
	font-size: 12px;
}

.STYLE5 {
	color: #0a6e0c;
	font-size: 12px;
}

body {
	margin-top: 0px;
	margin-bottom: 0px;
}

.STYLE7 {
	font-size: 12
}
-->
</style>
<script language="javascript">
	function checkForm() {
		var termId = document.getElementById("termId").value;
		var deptId = document.getElementById("deptId").value;
		var teacherId = document.getElementById("teacherId").value;
		var evalPeriodId = document.getElementById("evalPeriodId").value;
		
		if (deptId == 0) {
			alert("请选择部门！");
			return false;
		}

		if (termId == 0) {
			alert("请选择学期！");
			return false;
		}
		
		if (evalPeriodId == 0) {
			alert("请选择评价时间段！");
			return false;
		}
		
		return true;
	}
</script>
<script language="javascript">
	var req;

	function init() {
		if (window.XMLHttpRequest) {
			req = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}

	//根据院系ID查询DropChangeAJAXAction，获得该院系的专业列表
	function changeDropOfTeacher() {
		init();

		var url = "dropChangeAJAX.do?method=changeDropOfTeacher&deptId="
				+ escape(document.forms[0].deptId.options[document.forms[0].deptId.selectedIndex].value);

		req.open("get", url, true);
		req.onreadystatechange = callback;
		req.send(null);
	}

	//根据院系ID和学期ID查询DropChangeAJAXAction，获得评价时间段列表
	function changeDropOfEvalPeriod() {
		init();

		var url = "dropChangeAJAX.do?method=changeDropOfEvalPeriod&deptId="
				+ escape(document.forms[0].deptId.options[document.forms[0].deptId.selectedIndex].value)
				+ "&termId="
				+ escape(document.forms[0].termId.options[document.forms[0].termId.selectedIndex].value);

		req.open("get", url, true);
		req.onreadystatechange = callback;
		req.send(null);
	}
	
	function callback() {
		if (4 == req.readyState) {
			if (200 == req.status) {
				eval(req.responseText);
			}
		}
	}
</script>

<html:form action="courseEvaluateQuery.do?method=queryForHistoryList" method="post" onsubmit="return checkForm();">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr>
			<td height="30">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>&nbsp;</td>
					<td style="padding-right: 10px;">
					<div align="right"></div>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td>
			<table width="100%" border="0" cellpadding="0" cellspacing="1"
				bgcolor="#c9c9c9">
				<tr>
					<td width="70%" height="22" bgcolor="#FFFFFF"><strong><span
						class="STYLE1">课程评价历史数据查询</span></strong></td>

				</tr>
				<tr>
					<td bgcolor="#FFFFFF">

					<table width="700" border="0" align="center" cellpadding="0"
						cellspacing="0">
						<tr>
							<td align="right">部门名称：</td>
							<td>
								<html:select property="deptId" onchange="changeDropOfTeacher()">
									<html:option value="0">请选择</html:option>
									<c:if test="${!empty deptList}">
										<html:optionsCollection name="deptList" label="deptName" value="id" />
									</c:if>
								</html:select>
								<font color="red">${deptIdError}</font>
							</td>
						</tr>
						
						<tr>
							<td width="164" align="right">学期：</td>
							<td width="536">
								<html:select property="termId" onchange="changeDropOfEvalPeriod()">
									<html:option value="0">请选择</html:option>
									<c:if test="${!empty termList}">
										<c:forEach items="${termList }" var="term">
											<html:option value="${term.id }">${term.startYear}—${term.endYear}学年度&nbsp;&nbsp;<c:choose><c:when test="${term.termOrder == 1 }">上学期</c:when><c:when test="${term.termOrder == 2 }">下学期</c:when></c:choose></html:option>
										</c:forEach>
									</c:if>
								</html:select>	
								<font color="red">${termIdError }</font>
							</td>
						</tr>

						<tr>
							<td width="164" align="right">评价时间选择：</td>
							<td width="536">
								<html:select property="evalPeriodId">
									<html:option value="0">请选择</html:option>
								</html:select>	
								<font color="red">${evalPeriodIdError }</font>
							</td>
						</tr>
												
						<tr>
							<td align="right">教师：</td>
							<td>
								<html:select property="teacherId" >
									<html:option value="0">请选择</html:option>
								</html:select>
								<font color="red">${courseHoursError}</font>
							</td>
						</tr>
						<tr>
							<td align="center">&nbsp;</td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="center">&nbsp;</td>
							<td><html:submit value="提交查询" /> &nbsp;&nbsp;&nbsp; <html:reset
								value="取 消" /></td>
						</tr>
					</table>
					</td>
				</tr>
			</table>
			</td>
		</tr>
		<tr>
			<td height="35">&nbsp;</td>
		</tr>
	</table>
</html:form>